cmake_policy(VERSION 3.9)

if(DEFINED ENV{DESTDIR})
  set(ROOT_DIR_ARG "--root=$ENV{DESTDIR}")
endif()
if(@CAN_USE_CMAKE_INSTALL_PREFIX_FROM_CMAKE_INSTALL@)
    file(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}" NATIVE_CMAKE_INSTALL_PREFIX)
    if (WIN32)
      string(REPLACE "\\" "\\\\" NATIVE_CMAKE_INSTALL_PREFIX "${NATIVE_CMAKE_INSTALL_PREFIX}")
    endif ()
    set(INSTALL_PREFIX "--prefix=${NATIVE_CMAKE_INSTALL_PREFIX}")
elseif( NOT @IGNORE_CMAKE_INSTALL_PREFIX_CONFIGURE_TIME_DIFFERENT_FROM_RUNTIME@ )
    if(NOT "@CMAKE_INSTALL_PREFIX@" STREQUAL "${CMAKE_INSTALL_PREFIX}")
       message(FATAL_ERROR "CMAKE_INSTALL_PREFIX passed at configuration time (@CMAKE_INSTALL_PREFIX@) is different from the one provided at cmake --install time (${CMAKE_INSTALL_PREFIX})")
    endif()
endif()
if(NOT "@SETUPTOOLS_USE_DISTUTILS@x" STREQUAL "x")
  set(ENV{SETUPTOOLS_USE_DISTUTILS} @SETUPTOOLS_USE_DISTUTILS@)
endif()
if(WIN32)
   set(PATH_SEP ";")
else()
   set(PATH_SEP ":")
endif()
if(DEFINED INSTALL_PREFIX)
   execute_process(COMMAND ${CMAKE_COMMAND} -E env "PATH=@PROJECT_BINARY_DIR@/apps${PATH_SEP}$ENV{PATH}" "@Python_EXECUTABLE_CMAKE@" "@SETUP_PY_FILENAME@" install ${ROOT_DIR_ARG} @INSTALL_ARGS@ "${INSTALL_PREFIX}"
                   WORKING_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@" RESULT_VARIABLE res)
else()
   execute_process(COMMAND ${CMAKE_COMMAND} -E env "PATH=@PROJECT_BINARY_DIR@/apps${PATH_SEP}$ENV{PATH}" "@Python_EXECUTABLE_CMAKE@" "@SETUP_PY_FILENAME@" install ${ROOT_DIR_ARG} @INSTALL_ARGS@
                   WORKING_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@" RESULT_VARIABLE res)
endif()
if(NOT res EQUAL 0)
   message( FATAL_ERROR "Installation of python bindings failed")
endif()
